from aiogram.types import ChatMember

from app.bot_init import bot

async def if_chanel_admin(channel_id: int, user_id: int) -> ChatMember | bool:
    admins = await bot.get_chat_administrators(channel_id)
    for a in admins:
        if a.user.id == user_id:
            return a
    return False


async def get_channel_admins(channel_id: int) -> list[ChatMember]:
    admins = await bot.get_chat_administrators(channel_id)
    return [a for a in admins if not a.user.is_bot]
